home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_PICT / Convert PICT.app / UncommentedPSCode / Regions < prev    next >
Text File  |  1995-06-12  |  3KB  |  172 lines

  1. %BEGIN Regions
  2. /frameRgn
  3. {
  4.     gsave
  5.         penPattern usePattern
  6.         /tempRight exch def
  7.         /tempBottom exch def
  8.         /tempLeft exch def
  9.         /tempTop exch def
  10.         /numShapes exch def
  11.         numShapes 0 eq
  12.         {
  13.             tempLeft tempTop tempRight tempTop
  14.             tempRight tempBottom tempLeft  tempBottom
  15.             4
  16.             /numShapes 1 def
  17.         }
  18.         {
  19.             tempTop tempLeft tempBottom tempRight regionBounds
  20.             clip
  21.         }
  22.         ifelse
  23.         penWidth 0 le
  24.         penHeight 0 le
  25.         or
  26.         {
  27.             numShapes
  28.             {
  29.                 { pop pop }
  30.                 repeat
  31.             }
  32.             repeat
  33.         }
  34.         {
  35.             newpath
  36.             numShapes
  37.             {
  38.                 /numCoords exch 2 mul def
  39.                 /ptArray  numCoords array def
  40.                 /firsty exch def
  41.                 /firstx exch def
  42.                 firstx firsty  moveto
  43.                 0 2 numCoords 3 sub    % 3 is for: zero origin, and skipped first coords
  44.                 {
  45.                     /arrayIndex exch def
  46.                     /y1 exch def
  47.                     /x1 exch def
  48.                     ptArray arrayIndex x1 put
  49.                     ptArray arrayIndex 1 add y1 put
  50.                     x1 y1 lineto
  51.                 }
  52.                 for
  53.                 closepath
  54.                 /pendx firstx penWidth add def
  55.                 numCoords 4  gt
  56.                 {
  57.                     ptArray 2 get pendx lt
  58.                         { /pendy firsty penHeight add def }
  59.                         { /pendy firsty penHeight sub def }
  60.                     ifelse
  61.                  }
  62.                 { /pendy firsty penHeight sub def  }
  63.                 ifelse
  64.                 /lastx ptArray 0 get   def
  65.                 /lasty ptArray 1 get  def
  66.                 pendx pendy  moveto
  67.                 2 4  numCoords 5 sub
  68.                 {
  69.                     /arrayIndex exch def
  70.                     /thisx ptArray arrayIndex get   def
  71.                     /thisy ptArray arrayIndex 1 add get  def
  72.                     /pendx lastx penWidth
  73.                         thisy lasty sub 0 gt {add}  {sub} ifelse
  74.                     def
  75.                     pendx pendy  lineto
  76.                     /lastx thisx def
  77.                     /lasty thisy def
  78.                     /thisx ptArray arrayIndex 2 add get   def
  79.                     /thisy ptArray arrayIndex 3 add get  def
  80.                     /pendy lasty penHeight
  81.                         thisx lastx sub 0 gt {sub}  {add } ifelse
  82.                     def
  83.                     pendx pendy  lineto
  84.                     /lasty thisy def
  85.                     /lastx thisx def
  86.                 }
  87.                 for
  88.                 firstx penWidth add pendy  lineto
  89.                 closepath
  90.             }
  91.             repeat
  92.             eofill
  93.         }
  94.         ifelse
  95.     grestore
  96. }
  97. def
  98. /paintRgn
  99. {
  100.     gsave
  101.         penPattern usePattern
  102.         regionBounds
  103.         /numShapes exch def
  104.         numShapes 0 eq
  105.         { fill }
  106.         {
  107.             clip
  108.             numShapes  regionPath
  109.             eofill
  110.         }
  111.         ifelse
  112.     grestore
  113. }
  114. def
  115. /eraseRgn
  116. {
  117.     gsave
  118.         backPattern usePattern
  119.         regionBounds
  120.         /numShapes exch def
  121.         numShapes 0 eq
  122.         { fill }
  123.         {
  124.             clip
  125.             numShapes  regionPath
  126.             eofill
  127.         }
  128.         ifelse
  129.     grestore
  130. }
  131. def
  132. /invertRgn
  133. {
  134.     gsave
  135.         regionBounds
  136.         regionPath
  137.     grestore
  138. } def
  139. /fillRgn
  140. {
  141.     gsave
  142.         fillPattern usePattern
  143.         regionBounds
  144.         /numShapes exch def
  145.         numShapes 0 eq
  146.         { fill }
  147.         {
  148.             clip
  149.             numShapes  regionPath
  150.             eofill
  151.         }
  152.         ifelse
  153.     grestore
  154. }
  155. def
  156. /frameSameRgn
  157.     { }
  158. def
  159. /paintSameRgn
  160.     { }
  161. def
  162. /eraseSameRgn
  163.     { }
  164. def
  165. /invertSameRgn
  166.     { }
  167. def
  168. /fillSameRgn
  169.     { }
  170. def
  171. %END Regions
  172.